import org.softmed.rest.server.core.restlet.RESTConfigRefresher;
import org.softmed.rest.generation.uri.URIBuilder;
import org.softmed.filehandling.FileUtil;




println "Setting the server root URI";

if(content == null || content.length() == 0 )
	throw SimpleException("Invalid URI. It should not be null and have more than zero characters.");

RESTConfigRefresher.getServer().setRootURI(content);
URIBuilder.setMainPath(RESTConfigRefresher.getServer().getMainPath());

println "done. changed to " + content;

FileUtil util = new FileUtil();
File file = util.getFile("root-uri.txt");

if(file.exists())
	file.delete();

file.createNewFile();
util.saveToFile(file, content);

println "main path changed to : " + RESTConfigRefresher.getServer().getMainPath();